﻿using System;
using System.Collections.Generic;
using System.Text;

namespace UMLDesigner.Data
{
    public class ClassMethod
    {
        public ClassMethod()
        {
            arguments = new List<Argument>();
            AccessType = Data.AccessType.PUBLIC;
            ReturnType = "void";
            Name = "";
        }

        public AccessType AccessType
        {
            get;
            set;
        }

        public string ReturnType
        {
            get;
            set;
        }

        public string Name
        {
            get;
            set;
        }

        public override string ToString()
        {
            return Data.AccessTypeString.GetTypeString(AccessType) + " " + Name + "(" + ")";
        }

        private string GetArgumentsAsString()
        {
            StringBuilder sb = new StringBuilder();

            int lastArgumentIndex = arguments.Count - 1;
            for (int i = 0; i < arguments.Count; i++)
            {
                sb.Append(arguments[i].Type);
                sb.Append(" ");
                sb.Append(arguments[i].Name);
                if (i != lastArgumentIndex)
                {
                    sb.Append(", ");
                }
            }

            return sb.ToString();
        }

        private struct Argument
        {
            public string Name
            {
                get;
                set;
            }

            public string Type
            {
                get;
                set;
            }
        }

        private List<Argument> arguments;
    }
}
